home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 2.1 KB | 80 lines |
- /*
- * QuickTime for Java SDK Sample Code
-
- Usage subject to restrictions in SDK License Agreement
- * Copyright: © 1996-1999 Apple Computer, Inc.
-
- */
- package mixer.mc;
-
- import mixer.display.MusicPartDisplay;
-
- import quicktime.*;
- import quicktime.app.audio.*;
- import quicktime.std.music.*;
- import quicktime.std.movies.*;
- import quicktime.std.movies.media.*;
-
- import javax.swing.*;
- import java.awt.*;
-
- /** This class is an implementation of the MixerComponents interface to deal
- * with Music tracks.
- */
- public class MixerMusicTrack implements MixerComponents {
- private MusicMediaControl master;
- private MixerMusicPart chans[] = null;
- private Movie mov;
-
- /** The constructor just needs to know which MusicMedia object it is related to. */
- public MixerMusicTrack (Movie mov, MusicMedia m) throws QTException {
- master = new MusicMediaControl(m);
- this.mov = mov;
- }
-
- /** Returns the AudioSpec object capable of controlling this MixerMusicTrack.
- * @return the AudioSpec control object
- */
- public AudioSpec getMaster () {
- return master;
- }
-
- /** This method creates the JComponent which contains the controls for modifying
- * the channels of this object.
- * @return the JComponent with the controls
- */
- public JComponent makeEditComponent () throws QTException {
- return new MusicPartDisplay (mov, getChannels());
- }
-
- /** This method returns an array of the MixerComponents which are the children
- * of this object.
- * @return the children MixerComponents
- */
- public MixerComponents[] getChannels () {
- if (chans == null) {
- try {
- int numComp = master.getPartCount();
- chans = new MixerMusicPart[numComp];
-
- for (int i = 0; i < numComp; i++)
- chans[i] = new MixerMusicPart(master.getPart(i+1));
- }
- catch (QTException e) {
- e.printStackTrace();
- }
- }
- return chans;
- }
-
- /** This object is defined as editable if there are some child channels.
- * @return the editable status
- */
- public boolean isEditable() {
- try {
- return master.getPartCount() > 0;
- } catch (QTException e) {
- return false;
- }
- }
- }